package com.jikexueshe.crm.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jikexueshe.crm.mapper.CPositionMapper;
import com.jikexueshe.crm.pojo.CPosition;
import com.jikexueshe.crm.service.PositionService;

@Service
public class PositionServieImpl implements PositionService {
	
	@Autowired
	private CPositionMapper positionMapper;

	@Override
	public void save(CPosition t) {
		positionMapper.insert(t);
	}

	@Override
	public void delete(Integer id) {
		positionMapper.deleteByPrimaryKey(id);
	}

	@Override
	public void update(CPosition t) {
		positionMapper.updateByPrimaryKey(t);
	}

	@Override
	public PageInfo<CPosition> select(Integer page,Integer rows,CPosition t) {
		PageHelper.startPage(page,rows);
		List<CPosition> list = positionMapper.select(t);
		return new PageInfo(list);
	}

	@Override
	public CPosition getById(Integer id) {
		return positionMapper.selectByPrimaryKey(id);
	}

}
